import type { Mapping } from "./ProFrom.vue";

const RULES: any = {
  phone: {
    pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
    message: "手机号码格式不正确",
    trigger: ["change", "blur"],
  },
  // tel: this.phone,
};

export const defaultRules = ({ required, label, prop }: Mapping) => {
  const requiredRule = { required, message: label + "不能为空" };

  return [requiredRule, RULES[prop]].filter((rule) => rule);
};
